<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div id="box" class="abc">
      hello
      <div id="box1" class="abcd">
        <p>this is tag p</p>
        <ul id="list">
          <li>1</li>
          <li id="li2">2</li>
          <li>3</li>
          <li>4</li>
        </ul>
      </div>
    </div>

    <input type="text" name="gender" id="" />
    <input type="text" name="gender" id="" />

    <script>
      /**/
      // 根据标签批量选择元素对象
      // console.log(document.getElementsByTagName("li"));
      console.log(document.querySelectorAll("li"));
      // 根据类名批量选择元素对象
      // console.log(document.getElementsByClassName("abc")); // .abc ❌
      console.log(document.querySelectorAll(".abc"));
      // 根据name属性批量选择元素对象
      // console.log(document.getElementsByName("gender"));
      console.log(document.querySelectorAll('[name="gender"]'));
    </script>
  </body>
</html>
